package com.tinem.platform.module.starter.config;

import com.tinem.platform.module.starter.EmqxClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author fzh
 * @version v1
 * @program: platform
 * @className JmsConfiguration
 * @description
 * @site
 * @company
 * @create 2021-11-08 14:10
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "emqx")
public class EmqxConfiguration {

    List<Config> config;

    @Data
    public static class Config{
        String clientId;
        /**
         * mqtt服务器地址
         * tcp://127.0.0.1:1883
         */
        String url;
        /**
         * 授权账号
         */
        String userName;
        /**
         * 客户端id
         */
        String password;

    }
    @Bean
    public EmqxClient emqxClient(){
        return new EmqxClient(config);
    }
}
